package org.study;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.locks.LockSupport;

public class FutureDemo {


    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true) {
                System.out.println(Thread.currentThread());
                LockSupport.park();
                System.out.println("执行线程");
            }
        });
        Thread main = Thread.currentThread();
        Thread thread2 = new Thread(() -> {
            while (true) {
                try {
                    Thread.sleep(3500);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                LockSupport.unpark(main);
            }
        });

        thread.start();
        thread2.start();
    }

}
